package inter;

import lexer.Token;
import symbols.Type;

public class Unary extends Op {
	//trata o menos unario
	public Expr expr;
	
	public Unary(Token tok, Expr x) {
		super(tok, null);
		expr = x;
		type = Type.compara(Type.INT, expr.type);
		
		if(type == null){
			error("Type error");
		}
	}
	
	public Expr gen(){
		return new Unary(op, expr.reduce());
	}
	
	public String toString(){
		return op.toString() + " " +  expr.toString();
	}

}
